<script setup lang="ts">
import { Line } from '@antv/g2plot';

import { onMounted, useTemplateRef, defineProps, watch } from 'vue';

const props = defineProps(['data'])

const cont = useTemplateRef('container')
let graph = null


onMounted(() => {
  graph = new Line(cont.value, {
    data: props.data,
    padding: 'auto',
    xField: '月份',
    yField: '风险值',
    seriesField: 's',
    appendPadding: [0, 8, 0, 0],
  });
  graph.render();
})
watch(() => props.data, () => { console.log(props.data); graph.changeData(props.data) })

</script>

<template>
  <div ref="container" style=""></div>
</template>
<style scoped>
* {
  color: white;
}
</style>
